import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';

@Component({
  selector: 'app-order-record',
  templateUrl: './order-record.component.html',
  styleUrls: ['./order-record.component.css']
})
export class OrderRecordComponent implements OnInit {

  showDetails = true;
  id = '';
  scrollTop: number;
  orderType: '';

  constructor(private route: ActivatedRoute) {
  }

  ngOnInit() {
    // console.log(this.route.snapshot.params, '对不对');
    this.orderType = this.route.snapshot.params['orderType'];
  }

// 点击列表切换显示状态
  viewState($event) {
    this.id = $event;
    this.scrollTop = $(document).scrollTop();
    this.showDetails = false;
  }

  // 关闭详情页
  close($event) {
    if ($event) {
      this.showDetails = true;
      $('html,body').animate({scrollTop: this.scrollTop}, 0.5);
    }
  }
}
